Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vk: improve code quality #617

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

blacktrub
Copy link

Proposed changes

I wanted to improve code quality of a VK back-end, because I had a problem when I wanted to extend it. So I decided it's a good idea to move vk_api function to class implementation, so we can use an inheritance with full power.

Types of changes

Please check the type of change your PR introduces:

  • Release (new release request)
  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (PEP8, lint, formatting, renaming, etc)
  • Refactoring (no functional changes, no api changes)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Build related changes (build process, tests runner, etc)
  • Other (please describe):

Checklist

Put an x in the boxes that apply. You can also fill these out after creating
the PR. If you're unsure about any of them, don't hesitate to ask. We're here to
help! This is simply a reminder of what we are going to look for before merging
your code.

  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works

Other information

Any other information that is important to this PR such as screenshots of how
the component looks before and after the change.

@codecov
Copy link

codecov bot commented Sep 21, 2021

Codecov Report

Merging #617 (eb9dfd2) into master (1ea27e8) will decrease coverage by 0.00%.
The diff coverage is 48.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #617      +/-   ##
==========================================
- Coverage   76.92%   76.92%   -0.01%     
==========================================
  Files         317      317              
  Lines        9630     9641      +11     
  Branches      962      964       +2     
==========================================
+ Hits         7408     7416       +8     
- Misses       2071     2073       +2     
- Partials      151      152       +1     
Flag Coverage Δ
unittests 76.92% <48.38%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
social_core/backends/vk.py 43.63% <48.38%> (+3.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1ea27e8...eb9dfd2. Read the comment docs.


def make_sure_access_token_exists(self, method, data):
if 'access_token' in data:
return data
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like access_token is always present, maybe the code can be simplified?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid it's not, when we call the method from VKAppOAuth2, we don't have access_token.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed the isAppUser call when reviewing, and lack of test coverage there made me think it is not used. Can you add tests for that?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I'll add.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@blacktrub Any chance to get to this? 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants